Clover coverage report - Flock Flock - 0.7-dev
Coverage timestamp: Thu Jan 30 2003 01:35:37 EST
file stats: LOC: 98   Methods: 13
NCLOC: 67   Classes: 1
This license of Clover is provided to support the development of Flock only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover.
 
 Source file Conditionals Statements Methods TOTAL
Tree.java 0% 0% 0% 0%
 1   
 package net.sf.flock.webapp.tree;
 2   
 
 3   
 import java.util.Collection;
 4   
 import java.util.Iterator;
 5   
 
 6   
 import net.sf.tapestry.AbstractComponent;
 7   
 import net.sf.tapestry.IBinding;
 8   
 import net.sf.tapestry.IMarkupWriter;
 9   
 import net.sf.tapestry.IRequestCycle;
 10   
 import net.sf.tapestry.RequestCycleException;
 11   
 import net.sf.flock.tree.ITreeNode;
 12   
 
 13   
 public class Tree extends AbstractComponent {
 14   
 
 15   
     private ITreeNode rootNode;
 16   
 
 17   
     private int depth = 0;
 18   
     private ITreeNode value;
 19   
     private IBinding valueBinding;
 20   
 
 21   
     
 22  0
     public ITreeNode getRootNode() {
 23  0
         return rootNode;
 24   
     }
 25   
 
 26  0
     public void setRootNode(ITreeNode rootNode) {
 27  0
         this.rootNode = rootNode;
 28   
     }
 29   
     
 30   
 
 31  0
     public int getDepth() {
 32  0
         return depth;
 33   
     }
 34   
 
 35  0
     public ITreeNode getValue() {
 36  0
         return this.value;
 37   
     }
 38   
 
 39  0
     public IBinding getValueBinding() {
 40  0
         return valueBinding;
 41   
     }
 42   
 
 43  0
     public void setValueBinding(IBinding valueBinding) {
 44  0
         this.valueBinding = valueBinding;
 45   
     }
 46   
     
 47   
     /**
 48   
      * @see net.sf.tapestry.AbstractComponent#renderComponent(IMarkupWriter, IRequestCycle)
 49   
      */
 50  0
     protected void renderComponent(IMarkupWriter writer, IRequestCycle cycle) throws RequestCycleException {
 51  0
         this.enterChildren(writer, cycle);
 52  0
         this.renderNodes(writer, cycle, this.rootNode);
 53  0
         this.leaveChildren(writer, cycle);
 54   
     }
 55   
     
 56  0
     protected void renderNodes(IMarkupWriter writer, IRequestCycle cycle, ITreeNode node) throws RequestCycleException {
 57  0
         this.depth++;
 58  0
         this.value = node;
 59  0
         if (this.valueBinding!=null) {
 60  0
             this.valueBinding.setObject(value);
 61   
         }
 62   
         
 63  0
         this.enterNode(writer, cycle);
 64   
 
 65  0
         this.renderCurrentNode(writer, cycle);
 66   
 
 67  0
         Collection children = node.getChildren();
 68  0
         if (children!=null) {
 69  0
             this.enterChildren(writer, cycle);
 70  0
             for (Iterator i=children.iterator(); i.hasNext(); ) {
 71  0
                 this.renderNodes( writer, cycle, (ITreeNode)i.next() );
 72   
             }
 73  0
             this.leaveChildren(writer, cycle);
 74   
         }
 75   
 
 76  0
         this.leaveNode(writer, cycle);
 77   
 
 78  0
         this.depth--;
 79   
     }
 80   
 
 81   
 
 82  0
     protected void enterNode(IMarkupWriter writer, IRequestCycle cycle) throws RequestCycleException {
 83   
     }
 84   
 
 85  0
     protected void leaveNode(IMarkupWriter writer, IRequestCycle cycle) throws RequestCycleException {
 86   
     }
 87   
 
 88  0
     protected void enterChildren(IMarkupWriter writer, IRequestCycle cycle) throws RequestCycleException {
 89   
     }
 90   
 
 91  0
     protected void leaveChildren(IMarkupWriter writer, IRequestCycle cycle) throws RequestCycleException {
 92   
     }
 93   
 
 94  0
     protected void renderCurrentNode(IMarkupWriter writer, IRequestCycle cycle) throws RequestCycleException {
 95  0
         this.renderBody(writer, cycle);
 96   
     }
 97   
 
 98   
 }